dllmain.c File Reference

#include "dll.h"
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

Go to the source code of this file.

Defines

#define MAX_SIZE   12

Functions

DLLIMPORT void ssolution (int iboard[MAX_SIZE][MAX_SIZE], int iblength, int isolutions, int *iauthor, char cfilename[100])
 ssolution
BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)


Detailed Description

PURPOSE: File contains ssolution

Author:
Daniel Hasemann
Version:
1.2
Date:
December 16th, 2005

Definition in file dllmain.c.


Define Documentation

#define MAX_SIZE   12
 

Definition at line 15 of file dllmain.c.

Referenced by options().


Function Documentation

BOOL APIENTRY DllMain HINSTANCE  hInst,
DWORD  reason,
LPVOID  reserved
 

Definition at line 73 of file dllmain.c.

00076 {
00077     switch (reason)
00078     {
00079       case DLL_PROCESS_ATTACH:
00080         break;
00081 
00082       case DLL_PROCESS_DETACH:
00083         break;
00084 
00085       case DLL_THREAD_ATTACH:
00086         break;
00087 
00088       case DLL_THREAD_DETACH:
00089         break;
00090     }
00091 
00092 
00093     return TRUE;
00094 }

DLLIMPORT void ssolution int  iboard[MAX_SIZE][MAX_SIZE],
int  iblength,
int  isolutions,
int *  iauthor,
char  cfilename[100]
 

ssolution

This dll file saves the solution on HDD. Char array cfilename includes the filename where the solution should be saved. If the filename is invalid a message tells the filename cannot write.

Parameters:
iboard is an integer array
iblength is an integer
isolutions is an integer
*iauthor is an integer pointer
cfilename is a char array
See also:
calculate()
Author:
Daniel Hasemann
Date:
December 16th, 2005

Definition at line 32 of file dllmain.c.

00033 {
00034     FILE *pfile;
00035     int ik;
00036     int ii;
00037    
00038     pfile=fopen(cfilename,"a");
00039     if(!pfile)
00040     {
00041         gotoxy(3,16);
00042         printf("Filename Error!");
00043         gotoxy(3,17);
00044         printf("Can%ct write [%s]",39,cfilename);     //ascii 39=´
00045     }
00046     else
00047     {
00048         
00049         if(!*iauthor)                                 //text-file-header
00050         {
00051             fprintf(pfile,"%d-QUEENS-PROBLEM\nAuthor : Daniel Hasemann\nVersion : 1.2\n\n",iblength);
00052             *iauthor=1;
00053         }
00054         
00055         for(ii=0;ii<iblength;ii++)
00056         {   
00057             for(ik=0;ik<iblength;ik++)
00058             {
00059                 if(iboard[ik][ii])
00060                 {
00061                     fprintf(pfile,"[%c%d]",ii+65,iblength-ik); //prints solution in file
00062                 }    
00063                
00064             }
00065         }
00066         fprintf(pfile," >>>Solution [%d] ",isolutions);        //prints number of solution in file
00067         fprintf(pfile,"\n");                                   //next line
00068         fclose(pfile);
00069     }
00070 }


Generated on Sun Dec 18 19:26:14 2005 for n-Queens Problem by  doxygen 1.4.5